package day17.animal;

public class test {
    public static void main(String[] args) {

        // 创建猫类实例
        cat c = new cat("小猫", 1, "黑色", "5kg");
        c.eat();
        c.sleep();
        c.run();
        System.out.print(c.name + "  ");
        System.out.print(c.age + "  ");
        System.out.print(c.color + "  ");
        System.out.println(c.weight + "  ");

        // 使用多态创建猫类实例
        animal a = new cat("布偶猫", 2, "白色", "3kg");
        a.eat();
        a.sleep();
        a.run();
        System.out.print(a.name + "  ");
        System.out.println(a.age + "  ");

        // 创建狗类实例
        dog d = new dog("旺财", 2, "黄色", "60cm");
        d.eat();
        d.sleep();
        d.run();
        System.out.print(d.name + "  ");
        System.out.print(d.age + "  ");
        System.out.print(d.color + "  ");
        System.out.println(d.height + "  ");

        // 使用多态创建狗类实例
        animal a1 = new dog("旺仔", 5, "白色", "70cm");
        a1.eat();
        a1.sleep();
        a1.run();
        System.out.print(a1.name + "  ");
        System.out.print(a1.age + "  ");
        System.out.println(a1.color + "  ");
        
    }
}